Skip to content

feat(sim): add native cross-harness Self-Improvement Memory - #64

Merged
collissimo merged 1 commit into
collin/mainfrom
t3/sim-cross-harness
Nov 19, 2026
Merged

collissimo merged 1 commit into
collin/mainfrom
t3/sim-cross-harness

Conversation

@collissimo

Copy link
Copy Markdown
Owner

Harness self-improvement memory (SIM) previously only worked inside Claude Code via local hooks and CLI scripts, leaving Codex, Antigravity (ACP), OpenCode, and other T3 Code providers without shared rule injection, read-before-write gates, anti-self-grading, live runtime signals, or unified auditing.

This adds native, file-backed cross-harness SIM integration to the fork with zero SQLite migrations, keeping agentContextBudget.json byte-identical to upstream and staying 100% format-v2 / schema-3 compatible with standalone sim.mjs:

  • Core SIM Engine & Unified Audit (apps/server/src/sim/): SimStore, SimService, and SimAuditService share ~/.claude/sim/ (sim.jsonl, sim.json, seen/, t3-epochs.json, telemetry.jsonl). harness is stamped only on the sim.jsonl event envelope while sim.json stays schema 3 byte-for-byte identical to sim.mjs (no ping-pong rewrites). Read paths and dry runs use loadReadOnly without locking or healing sim.json. SimAuditService scans T3 SQLite read-only across all providers/models, telemetry, external Claude logs, and flags CLI fork self-grades (FORK SELF-GRADE).
  • Native MCP Toolkit (apps/server/src/mcp/toolkits/sim/): Exposes sim_read, sim_write, and sim_apply_harness_change to all providers. Caller identity (t3: thread, cc: native Claude session, fork family, driver, model, worktreePath ?? project.workspaceRoot) is derived strictly server-side from McpInvocationContext + projections. Enforces per-epoch index/by_file + entry read-before-write, fork/side-chat anti-self-grading, symlink + file-mode preservation on edit/rollback, and full-access/default mode + harnessDir/workspace confinement for live applies (dryRun: true works in all modes).
  • Cross-Harness Rule Injection & ACP Wiring: Injects filtered harness rules and a compact SIM guide (<4KB per section for Codex) into Codex, ACP, and OpenCode, cached per context epoch with a zero-I/O fast path for Claude Code and cache hits. Adds threadInstructions delivery to ACP.
  • Live Observer & On-Demand Advisor (ServerSettings.sim): SimObserverReactor persists active provider threads in t3-epochs.json (resetting seen epochs on compaction, handoff, or /clear/provider switch even across restarts) and records harness/runtime signals to telemetry.jsonl. ServerSettings.sim.advisorModelSelection (default claudeAgent / claude-fable-5-2, configurable or null) surfaces on-demand delegate_task (role: "design") hints only during review/audit for genuinely tricky cases.

Verification

  • Targeted suites: 157/157 tests across 11 SIM/MCP/ACP/settings/budget files + 83/83 RunExecutionService.test.ts + ClaudeAdapterV2.test.ts pass.
  • Typechecks: apps/server, apps/desktop, and apps/web (plus all 42 workspace packages via check:changed) pass with 0 errors.
  • Format, lint & knip: vp fmt, vp lint, and vp run knip:check pass with 0 errors.
  • Independent two-pass review (Claude Opus 5.5) verified all fixes and byte-for-byte sim.json parity against unmodified sim.mjs on a temporary sandbox copy.

Built with Antigravity (gemini-4-neon), with Claude Opus 5.5 implementation/review delegates and Claude Fable 5.2 architecture advisor.

Previously, harness self-improvement memory (SIM) only ran through Claude Code hooks and CLI scripts, leaving Codex, Antigravity (ACP), OpenCode, and other T3 Code providers without shared rule injection, read-before-write enforcement, anti-self-grading, live runtime telemetry, or cross-provider auditing.

This adds native, file-backed cross-harness SIM integration to T3 Code with zero SQLite migrations and full format-v2 / schema-3 byte-for-byte parity with standalone sim.mjs:
- SimStore, SimService, and SimAuditService in apps/server/src/sim/ sharing ~/.claude/sim/ (envelope-only harness field, read-only loads without lock/rewrite, symlink and mode preservation, CLI fork self-grade auditing, and configurable on-demand advisor escalation via ServerSettings.sim.advisorModelSelection).
- Native MCP toolkit (sim_read, sim_write, sim_apply_harness_change) deriving caller identity server-side, enforcing per-epoch read-before-write and fork-family anti-self-grading, and gating live harness edits on full-access/default mode and workspace/harnessDir confinement.
- Filtered, epoch-cached thread instruction injection (<4KB Codex-safe sections) for Codex, ACP, and OpenCode, plus ACP threadInstructions passthrough.
- SimObserverReactor tracking restart-safe context epochs in t3-epochs.json and logging cross-provider harness/runtime signals to telemetry.jsonl.

Co-Authored-By: Antigravity (gemini-4-neon) with Claude Opus 5.5 and Claude Fable 5.2
@collissimo
collissimo merged commit f8a23f5 into collin/main Nov 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant